<?php
/*
* 企业库 显示页
* @package
* @author     Mark
* @copyright  Copyright (c) 2013 ixdcw team
* @version    $Id: 720296c20e49ab4b7d89ddb13b874dfb6c141676 $
*/
defined('IN_IXDCW') or exit('Access Denied');
require DT_CORE . '/' . $module . '/common.inc.php';
$id  = isset($id) ? intval($id) : 0;
$eid = isset($eid) ? intval($eid) : 0;

if (!$eid && !$id) {
	include template('com-notfound', 'message');
	exit();
}

$MOD_MEMBER = PCache::read('module-2.php');

// 经营模式
$modes = explode('|', $MOD_MEMBER['com_mode']);
// 公司类型
$types = explode('|', $MOD_MEMBER['com_type']);
// 公司规模
$sizes = explode('|', $MOD_MEMBER['com_size']);
// 资金类型
$moneys = explode('|', $MOD_MEMBER['money_unit']);


if ($eid) {
	if ($_groupid != 1 && !$admin_user) Prompt::message('你没有预览权限', 'goback');
	$companyInfo = CompanyEntry::getPreview($eid);
	$subtitles = array();

	//显示目录
	if (preg_match_all("/(<h1.*?>)(.*?)(<.+?>)/si", $companyInfo['content'], $matches)) {
		foreach($matches[1] as $v)	$str .= $v;
		preg_match_all("|<h1 id=\"cat(.*?)\" class=\"com-hd\">|", $str, $m);
		foreach($m[1] as $k => $v) $subtitles[$v] = trim($matches[2][$k]);
	}
}


if($id) $companyInfo = CompanyEntry::getShowInfoById($id);
$did = $id;
$table   = Table::name(Table::NAME_MERCHANT_DOC);
$topId   = CompanyEntry::getTopDown($table,$did,'down','did');
$downId  = CompanyEntry::getTopDown($table,$did,'top','did');


$categoryArr = PCache::read('category-4.php');
include template('show', 'company');